﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DevExpress.Web.ASPxEditors;
using DevExpress.Web.ASPxUploadControl;

namespace Crosland.Automotriz.Web.UserControl
{
    public partial class UploadControl : System.Web.UI.UserControl
    {




        protected void Page_Load(object sender, EventArgs e)
        {
       

            
        } 


        public void GuardarArchivoServer(String strDirectorio ,string[] strFileExtensions,int intMax,string strNomArchivo) {
                        
            ASPxUploadControl1.ValidationSettings.AllowedFileExtensions =strFileExtensions;

            ASPxUploadControl1.ValidationSettings.MaxFileSize = intMax;
            Session["UploadDirectory"] = strDirectorio;
            Session["strNomArchivo"]=strNomArchivo;
           
            
        }

        protected void UploadControl_FileUploadComplete(object sender, DevExpress.Web.ASPxUploadControl.FileUploadCompleteEventArgs e)
        {
            
            if (e.IsValid)
            {
                string resultFilePath = Session["UploadDirectory"].ToString() + Session["strNomArchivo"].ToString() + e.UploadedFile.FileName;
                e.UploadedFile.SaveAs(MapPath(resultFilePath));
            }

        }

    }
}